﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilLib.Msg
{
    public class Codes
    {
        /// <summary>
        /// 根据枚举对象获取对应值
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static string getValue(object obj)
        {
            if (obj.GetType()==typeof(InstructCode))
            {
                return ((Codes.InstructCode)Enum.Parse(typeof(Codes.InstructCode), ((Codes.InstructCode)obj).ToString())).GetHashCode().ToString();
            }
            else if (obj.GetType() == typeof(RemoteCtrlCode))
            {

            }
            else
            {

            }
            return "";
        }
        public enum InstructCode
        {
            //[Description("普通通信发送")]
            //COMONTRANS_SEND = 9000,
            //[Description("普通通信回复")]
            //COMONTRANS_RPLY = 9001,

            [Description("连接验证")]
            CONN_REQ = 1000,
            [Description("验证回复")]
            CONN_REP = 1001,

            [Description("心跳发送")]
            BEAT_SEND = 1100,
            [Description("心跳回复")]
            BEAT_RPLY = 1101,

            [Description("远程控制")]
            REMOTECTRL_REQ = 1200,
            [Description("控制回复")]
            REMOTECTRL_REP = 1201,

            [Description("参数设置")]
            SETPARAM_REQ = 1300,
            [Description("设置回复")]
            SETPARAM_REP = 1301,

            [Description("参数获取")]
            GETPARAM_REQ = 1400,
            [Description("获取回复")]
            GETPARAM_REP = 1401,

            [Description("状态监测")]
            STATES_REQ = 1500,
            [Description("监测回复")]
            STATES_REP = 1501
        }

        public enum RemoteCtrlCode
        {
            [Description("播放")]
            PLAY = 1,
            [Description("停止")]
            STOP = 2,
            [Description("休眠")]
            SLEEP = 3,
            [Description("重启")]
            RESTART = 4,
            [Description("唤醒")]
            WAKEUP = 5,
            [Description("终端拍照")]
            TAKEPHOTO = 6,
            [Description("终端截屏")]
            CAPTURE = 7,
            [Description("回传日志文件")]
            UPLOG = 8,
            [Description("升级程序")]
            UPGRADE = 9
        }
        public enum Reply
        {
            OK=0,
            ERROR=1
        }
    }
}
